Skip to content

Conversation

@Thihup
Copy link
Contributor

@Thihup Thihup commented Oct 5, 2025

Copy link
Contributor

@OndroMih OndroMih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, @Thihup ! Thanks!

I have a few requests. Especially about including FileNameCompleter and moving the JLine artifact to web profile feature set so that it's also available in Web Profile distribution.

@Thihup
Copy link
Contributor Author

Thihup commented Oct 5, 2025

@OndroMih Done!

Copy link
Contributor

@OndroMih OndroMih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to approve, thanks!

@avpinchuk
Copy link
Contributor

avpinchuk commented Oct 5, 2025

Problem with osgi-shell command in multimode with this update:

D:\opt>glassfish7\bin\asadmin
Use "exit" to exit and "help" for online help.
asadmin> osgi-shell
Use "exit" to exit and "help" for online help.
Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
gogo$

@dmatej
Copy link
Contributor

dmatej commented Oct 6, 2025

Problem with osgi-shell command in multimode with this update:

D:\opt>glassfish7\bin\asadmin
Use "exit" to exit and "help" for online help.
asadmin> osgi-shell
Use "exit" to exit and "help" for online help.
Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
gogo$

EDIT: I am wrong.

If I am not wrong, that is usual problem with Windows CMD32, can you try with PowerShell? I noticed some time ago that CMD doesn't support System.console() and one has to use System.in, which doesn't hide passwords and have also some other differences (is dumb as input stream).

@avpinchuk
Copy link
Contributor

avpinchuk commented Oct 6, 2025

If I am not wrong, that is usual problem with Windows CMD32, can you try with PowerShell? I noticed some time ago that CMD doesn't support System.console() and one has to use System.in, which doesn't hide passwords and have also some other differences (is dumb as input stream).

No. We should pause the asadmin jline terminal before creating the osgi jline terminal and resume it after osgi jline session done.

Without this patch osgi shell works fine in the multimode with autocompletion.

@dmatej
Copy link
Contributor

dmatej commented Oct 6, 2025

Checkstyle complains about using wildcards in imports.

@Thihup
Copy link
Contributor Author

Thihup commented Oct 6, 2025

@avpinchuk Could you try again, please?

@avpinchuk
Copy link
Contributor

@Thihup Everything works but auto-completion tips now include the contents of the current directory:

image

The situation is the same in Linux.

@Thihup
Copy link
Contributor Author

Thihup commented Oct 6, 2025

@avpinchuk Great to hear! Showing the file names was a suggestion of @OndroMih to help in commands like deploy.
I know JLine allows to specify a custom completer for each option.
However it would require a change in the way the completion is done right now, but in that case I would enable the FileNameCompleter in specific cases only

@avpinchuk
Copy link
Contributor

@OndroMih Should we suggest file names for all commands or only for those that take a file name as an argument?

@OndroMih
Copy link
Contributor

OndroMih commented Oct 6, 2025

I didn't realize that the FileNameCompleter wouldn't know the context and would offer files for each completion. If it's not too complicated, @Thihup , it would be good to do what @avpinchuk suggested - offer file completion only for commands that take file arguments.

If it's too difficult, we can maybe autocomplete only if the pattern is non-empty - e.g. we would complete files for >deploy app but not for > (empty line) or for deploy (line ends with a space).

Linux shell now completes files only if the command supports file arguments, or when the last word starts with / or ./.

@Thihup
Copy link
Contributor Author

Thihup commented Oct 10, 2025

Now the FileNameCompleter is available only in specific options and when the user specifies a token similar to a path (like ., /, ~, etc). @OndroMih @avpinchuk Could you please check if the behavior is OK now?

@OndroMih
Copy link
Contributor

Awesome, @Thihup , you're a coding god!

Everything works perfectly when I tested it.

Just one thing - when I press Ctrl+D to quit the session, I get this exception before asadmin exits:

Use "exit" to exit and "help" for online help.
asadmin> list-domains 
domain1 not running
Command list-domains executed successfully.
asadmin> 
Exception in thread "main" org.jline.reader.EndOfFileException
	at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:722)
	at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:534)
	at com.sun.enterprise.admin.cli.MultimodeCommand$JLinePrompter.prompt(MultimodeCommand.java:404)
	at com.sun.enterprise.admin.cli.MultimodeCommand.executeCommands(MultimodeCommand.java:436)
	at com.sun.enterprise.admin.cli.MultimodeCommand.executeCommand(MultimodeCommand.java:149)
	at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:296)
	at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:309)
	at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:236)
	at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:35)

it happens every time, even if I just start asadmin and press Ctrl+D immediately. When I press Ctrl+C instead, I don't get the exception.

@Thihup
Copy link
Contributor Author

Thihup commented Oct 10, 2025

Fixed!

Copy link
Contributor

@avpinchuk avpinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job. Thank you!

@OndroMih OndroMih merged commit 1d65b02 into eclipse-ee4j:master Oct 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants